<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
        "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
    <title>Title</title>
    <meta http-equiv="Content-Type" content="text/html;charset=UTF-8">
    <link rel="stylesheet" href="css/bootstrap.min.css">
    <script type="text/javascript" src="js/jquery-3.1.1.min.js"></script>
    <script type="text/javascript">
        $(function () {


            $(".form-control").blur(function () {
                vs = $(this).val();
                ke=$(this).attr("name");
                str="res={"+ke+":vs}";
                eval(str);
                console.log(res);
                bn = $(this);
                $.ajax({
                    url:'demo.php',
                    type:"post",
                    dataType:"json",
                    data:res,
                    success:function(data,succ,hr){
                       bn.next().attr("class","glyphicon glyphicon-remove form-control-feedback");
                        console.log(data);

                    },
                    error:function(aa,bb,cc){
                        //失败执行的方法
                        //console.log(cc);
//                        alert("cc");
//
                   }

                })

            });



//


        })
    </script>
    <style type="text/css">
        body >  .cb{
            width: 700px;
            height: 400px;
            margin: 0 auto;
        }
    </style>
</head>
<body>
<div class="bs-example cb" data-example-id="form-validation-states-with-icons">
    <form>
        <div class="form-group has-success has-feedback">
            <label class="control-label" for="gg">姓名</label>
            <input type="text" class="form-control" id="gg" aria-describedby="inputSuccess2Status" name="a">
            <span class="glyphicon glyphicon-ok form-control-feedback" aria-hidden="true" id="m"></span>
            <span id="inputSuccess2Status" class="sr-only">(success)</span>
        </div>
        <div class="form-group has-warning has-feedback">
            <label class="control-label" for="inputWarning2">密码</label>
            <input type="text" class="form-control" id="inputWarning2" aria-describedby="inputWarning2Status" name="b">
            <span class="glyphicon glyphicon-warning-sign form-control-feedback" aria-hidden="true"></span>
            <span id="inputWarning2Status" class="sr-only">(warning)</span>
        </div>
        <div class="form-group has-error has-feedback">
            <label class="control-label" for="inputError2">确认密码</label>
            <input type="text" class="form-control" id="inputError2" aria-describedby="inputError2Status" name="c">
            <span class="glyphicon glyphicon-remove form-control-feedback" aria-hidden="true"></span>
            <span id="inputError2Status" class="sr-only">(error)</span>
        </div>
        <div class="form-group has-success has-feedback">
            <label class="control-label" for="inputGroupSuccess1">邮箱</label>
            <div class="input-group">
                <span class="input-group-addon">@</span>
                <input type="text" class="form-control" id="inputGroupSuccess1" aria-describedby="inputGroupSuccess1Status" name="d">
            </div>
            <span class="glyphicon glyphicon-ok form-control-feedback" aria-hidden="true"></span>
            <span id="inputGroupSuccess1Status" class="sr-only">(success)</span>
        </div>
    </form>
</div>
</body>
</html>